using IcsSEMCtrl.Util;
namespace Lifter.Global.Device
{
    public class PortWIWO
    {
        public const int _NONE = 0;
        public const int _WAIT_IN = 1;
        public const int _WAIT_OUT = 2;
        private int _value;
        private static int _size;
        private static PortWIWO[] _array;
        public static string[] displayStrings;
        public static PortWIWO[] displayValues;
        public static PortWIWO NONE;
        public static PortWIWO WAIT_IN;
        public static PortWIWO WAIT_OUT;
        public static PortWIWO IT_ENUM_MAX;
        static PortWIWO()
        {
            PortWIWO._size = 3;
            PortWIWO._array = new PortWIWO[PortWIWO._size];
            PortWIWO.displayStrings = new string[PortWIWO._size];
            PortWIWO.displayValues = new PortWIWO[PortWIWO._size];
            PortWIWO.NONE = new PortWIWO(0);
            PortWIWO.WAIT_IN = new PortWIWO(1);
            PortWIWO.WAIT_OUT = new PortWIWO(2);
            PortWIWO.IT_ENUM_MAX = new PortWIWO(2147483647);
            PortWIWO.displayStrings[0] = "NONE";
            PortWIWO.displayStrings[1] = "WAIT_IN";
            PortWIWO.displayStrings[2] = "WAIT_OUT";
            PortWIWO.displayValues[0] = PortWIWO.NONE;
            PortWIWO.displayValues[1] = PortWIWO.WAIT_IN;
            PortWIWO.displayValues[2] = PortWIWO.WAIT_OUT;
        }
        public static string ValueToString(PortWIWO val)
        {
            string result;
            if (val != null)
            {
                switch (val.Value())
                {
                    case 0:
                        result = PortWIWO.displayStrings[0];
                        break;
                    case 1:
                        result = PortWIWO.displayStrings[1];
                        break;
                    case 2:
                        result = PortWIWO.displayStrings[2];
                        break;
                    default:
                        result = "";
                        break;
                }
            }
            else
            {
                result = "";
            }
            return result;
        }
        public static PortWIWO StringToValue(string val)
        {
            PortWIWO result;
            if (Helper.IsNullOrEmpty(val))
            {
                result = PortWIWO.IT_ENUM_MAX;
            }
            else
            {
                for (int i = 0; i < PortWIWO.displayStrings.Length; i++)
                {
                    if (val.Equals(PortWIWO.displayStrings[i]))
                    {
                        result = PortWIWO.displayValues[i];
                        return result;
                    }
                }
                result = null;
            }
            return result;
        }
        public int Value()
        {
            return this._value;
        }
        public static PortWIWO From_Int(int value)
        {
            PortWIWO result;
            if (value >= 0 && value < PortWIWO._size)
            {
                result = PortWIWO._array[value];
            }
            else
            {
                result = PortWIWO.IT_ENUM_MAX;
            }
            return result;
        }
        protected PortWIWO(int value)
        {
            this._value = value;
            if (value >= 0 && value < PortWIWO._size)
            {
                PortWIWO._array[this._value] = this;
            }
        }
        public bool Equals(PortWIWO otherEnum)
        {
            return otherEnum.Value() == this._value;
        }
        public override string ToString()
        {
            return PortWIWO.displayStrings[this._value];
        }
    }
}
